<template>
  <div>
      <div class="content-wrap"  ref="wrap"  >
          <keep-alive :include="$store.state.viewIncludes"  >
              <router-view ></router-view>
          </keep-alive>
      </div>
  </div>
</template>

<script>
  export default {
      mounted() {

      },
      components: {

    },
    data() {
      return {

      }
    },
    methods: {
        refreshPage () {
            let _this=this;
            let activeMenu=this.$store.state.globalState.activeMenu;
            console.log("触发app1微前端刷新")
            _this.$store.commit('deleteViewIncludes', activeMenu.compo);
            _this.$router.push({path: '/blank'});//跳到空白
            this.$nextTick(() => {
                let path=activeMenu.path.substring(1,activeMenu.path.length);
                path=path.substring(path.indexOf("/"),path.length);
                _this.$router.push({path: path});
                _this.$store.commit('addViewIncludes', activeMenu.compo);
            })
        },
    },
    watch:{
        //监听页面刷新操作
        '$store.state.globalState':function(){
            let _this=this;
            if(_this.$store.state.globalState.reload){
                _this.refreshPage()
                let activeMenu=this.$store.state.globalState.activeMenu;
                _this.$store.commit('setGlobalState',{activeMenu:activeMenu,reload:false});
            }else{
                console.log("不做操作")
            }
        },
      $route (to,from){

      },
    }
  }
</script>

<style>

</style>

